package niit.wei.dao.impl;

import niit.wei.dao.BookDao;
import niit.wei.entity.Book;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

/**
 * @Author WeiJinLong
 * @Date 2023-06-28 20:53
 * @Version 1.0
 */
public class BookDaoImpl extends BaseDao<Book> implements BookDao {
    @Override
    public void addBook(Connection conn, String sql, Object... args) throws SQLException {
        update(conn, sql, args);
    }

    @Override
    public void updateBook(Connection conn, String sql, Object... args) throws SQLException {
        update(conn, sql, args);
    }

    @Override
    public void deleteBook(Connection conn, String sql, Object... args) throws SQLException {
        update(conn, sql, args);
    }

    @Override
    public List<Book> getBookList(Connection conn, String sql, Class<Book> clazz, Object... args) throws SQLException, NoSuchFieldException, InstantiationException, IllegalAccessException {
        return  getList(conn, sql, clazz, args);
    }

    @Override
    public Book getBook(Connection conn, String sql, Class<Book> clazz, Object... args) throws SQLException, NoSuchFieldException, InstantiationException, IllegalAccessException {
        return getOne(conn, sql, clazz, args);
    }

    @Override
    public Long getBookCount(Connection conn, String sql, Object... args) throws SQLException {
        Long count = getCount(conn, sql, args);
        return count;
    }
}
